package sample.plugin.language;

import android.graphics.drawable.Drawable;

import com.rapid.api.framework.ServiceKeys;
import com.rapid.api.framework.common.icon.IconService;
import com.rapid.api.framework.project.file.DefaultOpeningOption;
import com.rapid.api.framework.project.file.ProjectFileExtender;
import com.rapid.framework.program.android.app.AndroidPlugin;
import com.rapid.util.android.ContextUtils;

public class MyApplication extends AndroidPlugin {
    @Override
    public void activate() {
        ProjectFileExtender fileExtender = getFramework().getService(ServiceKeys.FILE_TYPE);
        fileExtender.addPSObjectOpeningOption(DefaultOpeningOption.INSTANCE, "lua", "py");

        IconService iconProvider = getService(ServiceKeys.ICON);
        Drawable luaIcon = ContextUtils.getDrawable(this, R.drawable.ic_lua);
        Drawable pythonIcon = ContextUtils.getDrawable(this, R.drawable.ic_python);
        iconProvider.putFileIcon(luaIcon, "lua");
        iconProvider.putFileIcon(pythonIcon, "py");
    }
}
